function ImportJS(pathArray) {
	var conn = createConn();
	if(checkId(pathArray)){
		conn.open("GET", pathArray, false);
		conn.send(null);
		includeJS(conn.responseText, pathArray);
	}
};

function ImportJSArray(pathArray) {
	var conn = createConn();
	for (var i = 0; i < pathArray.length; i++) {
		if(checkId(pathArray[i])){
			conn.open("GET", pathArray[i], false);
			conn.send(null);
			includeJS(conn.responseText, pathArray[i]);
		}
	}
};

function GetHttpRequest() {
	if (window.XMLHttpRequest)
		return new XMLHttpRequest();
	else if (window.ActiveXObject)
		return new ActiveXObject("MsXml2.XmlHttp");
}

function createConn() {
	var activeX = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'], CONTENTTYPE = 'Content-Type';

	var http;
	try {
		http = new XMLHttpRequest();
	} catch (e) {
		for (var i = 0; i < activeX.length; ++i) {
			try {
				http = new ActiveXObject(activeX[i]);
				break;
			} catch (e) {
			}
		}
	} finally {
		return http;
	}
};

function includeJS(source, id) {
	if (source != null) {
		var oHead = document.getElementsByTagName('HEAD').item(0);
		var oScript = document.createElement("script");
		oScript.language = "javascript";
		oScript.type = "text/javascript";
		//oScript.defer = true;
		oScript.id = id;
		oScript.text = source;
		oHead.appendChild(oScript);
	}
};

function checkId(id){
	if(document.getElementById(id)){
		return false;
	}else{
		return true;
	}
}
